import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  { path: '/login', component: () => import('@/views/login/login.vue'), meta: { keepAlive: false } },
  { path: '/search', component: () => import('@/views/search') },
  { path: '/user/profile', component: () => import('@/views/user-profile') },
  { path: '/user/:userId', component: () => import('@/views/user'), props: true },
  { path: '/article/:articleId', component: () => import('@/views/article'), props: true },
  { path: '/user/fans/:active/:id', component: () => import('@/views/fans-list'), props: true },
  {
    path: '/',
    redirect: '/home',
    component: () => import('@/views/layout/index.vue'),
    meta: { keepAlive: true },
    children: [{
      path: '/home', component: () => import('@/views/home/index.vue')
    },
    {
      path: '/qa', component: () => import('@/views/qa/index.vue')
    },
    {
      path: '/video', component: () => import('@/views/video/index.vue')
    },
    {
      path: '/my', component: () => import('@/views/my/index.vue')
    }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
